﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_ACEIndex.cshtml";
}

@this.Partial("Index-js")
<script>
    var wfnodeactionList=@this.RawSerialize(this.ViewBag.WfnodeactionList)

</script>

<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$ace.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            <button class="btn btn-primary" data-bind="click:Edit,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-pencil-square-o"></i>修改</button>
            <button class="btn btn-primary" data-bind="click:Delete,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-trash-o"></i>删除</button>
            <button class="btn btn-primary" data-bind="click:Add"><i class="fa fa-plus"></i>添加</button>
        </div>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="id/操作者id" style="width: 200px;" data-bind="value:SearchModel().keyword">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary" data-bind="click:Search"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>


<div class="table-responsive">
    <table class="table table-hover" data-bind="with:DataTable">
        <thead>
            <tr>
                <th style="width:20px;"></th>
                <th>id</th>
                <th>执行动作</th>
                <th>操作者</th>
                <th>操作者类型</th>
                <th>开始时间</th>
                <th>结束时间</th>
                <th>状态</th>
                <th>操作锁定</th>
            </tr>
        </thead>

        <tbody data-bind="foreach:Models">
            <tr data-bind="click:$parent.SelectRow">
                <td data-bind="text:$parent.GetOrdinal($index())"></td>
                <td data-bind="text:id"></td>
                <td data-bind="text:$ace.getOptionTextByValue(wfnodeactionList,nodeactionid(),'id','nodeactionmemo')"></td>
                <td data-bind="text:nodeoperator"></td>
                <td data-bind="text:operatortype()==1?'角色':'用户'"></td>
                <td data-bind="dateString:begintime"></td>
                <td data-bind="dateString:endtime"></td>
                <td data-bind="text:operatorstatus()==1?'已启用':'未启用'"></td>
                <td data-bind="text:operatorlock()==1?'未锁定':'已锁定'"></td>
            </tr>
        </tbody>
        @this.Partial("_tfoot")
    </table>
</div>


@using (Html.Dialog())
{

    <form id="form1">
        <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
            <div style="padding-top: 20px; margin-right: 30px;">
                <table class="form"> 
                    <tr>
                         <td class="formTitle">动作名称</td>
                        <td class="formValue">
                           <select id="wfid" name="wfid"class="form-control" data-bind="value:Model().wfid,event:{change:function(){OnWorkflowChange();}}">
                            @this.SelectOptions(this.ViewBag.WorkflowList)
                           </select>   
                         </td>     
                    </tr>
                    <tr>
                        <td class="formTitle">动作名称</td>
                        <td class="formValue">
                             <select id="nodeactionid" name="nodeactionid"class="form-control" data-bind="options:WorkflowNodeActionList,optionsText:'nodeactionmemo',optionsValue:'id', optionsCaption:'--请选择--',value:Model().nodeactionid"></select>
                             </td>                 
                    </tr>
                    <tr>
                        <td class="formTitle">操作者</td>
                        <td class="formValue">
                            <input id="nodeoperator" name="nodeoperator" type="text" class="form-control" data-bind="value:Model().nodeoperator" />
                        </td>                       
                    </tr>
                    <tr>
                       <td class="formTitle">操作者类型</td>
                        <td class="formValue">
                             <select id="operatortype" name="operatortype" class="form-control " data-bind="value:Model().operatortype">
                            <option value="1" selected="selected" >角色</option>
                            <option value="2">用户</option>
                        </select>
                              </td> 
                    </tr>

                    <tr>                        
                        <td class="formTitle">开始时间</td>
                        <td class="formValue">
                            <input id="begintime" name="begintime" type="text" class="form-control input-wdatepicker Wdate" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" data-bind="value:Model().begintime" />
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle">结束时间</td>
                        <td class="formValue">
                            <input id="endtime" name="endtime" type="text" class="form-control input-wdatepicker Wdate" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" data-bind="value:Model().endtime" />
                        </td>                       
                    </tr>
                    <tr>
                        <td class="formTitle">操作状态</td>
                        <td class="formValue">
                           
                             <select id="operatorstatus" name="operatorstatus" class="form-control " data-bind="value:Model().operatorstatus">
                            <option value="1" selected="selected" >已启用</option>
                            <option value="2">未启用</option>
                            </select>
                        </td>                       
                    </tr>
                    <tr>
                       <td class="formTitle">锁定状态</td>
                        <td class="formValue">
                         @*   <input id="operatorlock" name="operatorlock" type="text" class="form-control" data-bind="value:Model().operatorlock" />*@
                              <select id="operatorlock" name="operatorlock" class="form-control " data-bind="value:Model().operatorlock">
                            <option value="1" selected="selected" >未锁定</option>
                            <option value="2">已锁定</option>
                            </select>
                        </td> 
                    </tr>
                </table>
            </div>
        </div>
    </form>


}


